home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / winter_challenge.swf / scripts / frame_44 / PlaceObject2_138_182 / CLIPACTIONRECORD onClipEvent(load).as < prev   
Text File  |  2011-08-19  |  7KB  |  239 lines

  1. onClipEvent(load){
  2.    function ATVcontrol(faktorN, faktorP, fG, rG)
  3.    {
  4.       if(Key.isDown(37) && Key.isDown(38))
  5.       {
  6.          this.ATV.gotoAndStop("left");
  7.          _rotation = _rotation - faktorN;
  8.       }
  9.       if(Key.isDown(39) && Key.isDown(38))
  10.       {
  11.          this.ATV.gotoAndStop("right");
  12.          _rotation = _rotation + faktorP;
  13.       }
  14.       if(Key.isDown(37) && w > 0.1 && !Key.isDown(38) && !Key.isDown(40))
  15.       {
  16.          this.ATV.gotoAndStop("left");
  17.          _rotation = _rotation - faktorN;
  18.       }
  19.       if(Key.isDown(39) && w > 0.1 && !Key.isDown(38) && !Key.isDown(40))
  20.       {
  21.          this.ATV.gotoAndStop("right");
  22.          _rotation = _rotation + faktorP;
  23.       }
  24.       if(Key.isDown(37) && w < 0 && !Key.isDown(38) && !Key.isDown(40))
  25.       {
  26.          this.ATV.gotoAndStop("left");
  27.          _rotation = _rotation + faktorN;
  28.       }
  29.       if(Key.isDown(39) && w < 0 && !Key.isDown(38) && !Key.isDown(40))
  30.       {
  31.          this.ATV.gotoAndStop("right");
  32.          _rotation = _rotation - faktorP;
  33.       }
  34.       if(Key.isDown(37) && Key.isDown(40))
  35.       {
  36.          this.ATV.gotoAndStop("left");
  37.          if(w > 0)
  38.          {
  39.             _rotation = _rotation - faktorP;
  40.          }
  41.          else if(w < 0)
  42.          {
  43.             _rotation = _rotation + faktorP;
  44.          }
  45.       }
  46.       if(Key.isDown(39) && Key.isDown(40))
  47.       {
  48.          this.ATV.gotoAndStop("right");
  49.          if(w > 0)
  50.          {
  51.             _rotation = _rotation + faktorN;
  52.          }
  53.          else if(w < 0)
  54.          {
  55.             _rotation = _rotation - faktorN;
  56.          }
  57.       }
  58.       if(Key.isDown(38))
  59.       {
  60.          if(Key.isDown(38) && !Key.isDown(37) && !Key.isDown(39))
  61.          {
  62.             this.ATV.gotoAndStop("normal");
  63.          }
  64.          antrieb();
  65.       }
  66.       if(Key.isDown(40))
  67.       {
  68.          if(Key.isDown(40) && !Key.isDown(37) && !Key.isDown(39))
  69.          {
  70.             this.ATV.gotoAndStop("normal");
  71.          }
  72.          antrieb();
  73.       }
  74.       if(Key.isDown(38) && w > - fG && w < fG)
  75.       {
  76.          if(Key.isDown(40))
  77.          {
  78.             w = w;
  79.          }
  80.          else
  81.          {
  82.             w += acceleration;
  83.          }
  84.       }
  85.       if(Key.isDown(40) && w > - rG && w < fG)
  86.       {
  87.          if(Key.isDown(38))
  88.          {
  89.             w = w;
  90.          }
  91.          else
  92.          {
  93.             w -= acceleration;
  94.          }
  95.       }
  96.       if(w > 0.1 && !Key.isDown(38) && !Key.isDown(40))
  97.       {
  98.          antrieb();
  99.          w -= breakverzoegerung;
  100.       }
  101.       if(w < -0.1 && !Key.isDown(38) && !Key.isDown(40))
  102.       {
  103.          antrieb();
  104.          w += breakverzoegerung;
  105.       }
  106.       if(w < 0.1 && !Key.isDown(38) && !Key.isDown(40) && w >= 0)
  107.       {
  108.          w = 0;
  109.       }
  110.       if(w > -0.1 && !Key.isDown(38) && !Key.isDown(40) && w <= 0)
  111.       {
  112.          w = 0;
  113.       }
  114.       if(Key.isDown(39) != 1 && Key.isDown(37) != 1 && Key.isDown(38) != 1 && Key.isDown(40) != 1)
  115.       {
  116.          this.ATV.gotoAndStop("normal");
  117.       }
  118.    }
  119.    function antrieb()
  120.    {
  121.       _Y = _Y - Math.cos(0.017453292519943295 * _rotation) * w;
  122.       _X = _X + Math.sin(0.017453292519943295 * _rotation) * w;
  123.    }
  124.    function checkIntersect()
  125.    {
  126.       if(counterFlag == 1)
  127.       {
  128.          delayCounter++;
  129.          if(delayCounter >= 24)
  130.          {
  131.             counterFlag = 0;
  132.             delayCounter = 0;
  133.          }
  134.       }
  135.       if(_root.track_1.hitTest(_root.ATVclip.getBounds(_root).xMax + w,_root.ATVclip.new_y,true))
  136.       {
  137.          trace("hit: nMax, _y");
  138.          thisSound = _root.bang1;
  139.          newVolume = setSoundVolume(thisSound);
  140.          thisSound.setVolume(newVolume);
  141.          thisSound.start(0,1);
  142.          if(counterFlag != 1 && _root.redTire_cheat == 0)
  143.          {
  144.             counterFlag = 1;
  145.          }
  146.          return undefined;
  147.       }
  148.       if(_root.track_1.hitTest(_root.ATVclip.getBounds(_root).xMin - w,_root.ATVclip.new_y,true))
  149.       {
  150.          trace("hit: xMin, _y");
  151.          thisSound = _root.bang1;
  152.          newVolume = setSoundVolume(thisSound);
  153.          thisSound.setVolume(newVolume);
  154.          thisSound.start(0,1);
  155.          if(counterFlag != 1 && _root.redTire_cheat == 0)
  156.          {
  157.             reduceShields(0,Math.abs(w));
  158.          }
  159.          counterFlag = 1;
  160.          return undefined;
  161.       }
  162.       if(_root.track_1.hitTest(_root.ATVclip.new_x,_root.ATVclip.getBounds(_root).yMax + w,true))
  163.       {
  164.          trace("hit: _x, yMax");
  165.          thisSound = _root.bang1;
  166.          newVolume = setSoundVolume(thisSound);
  167.          thisSound.setVolume(newVolume);
  168.          thisSound.start(0,1);
  169.          if(counterFlag != 1 && _root.redTire_cheat == 0)
  170.          {
  171.             reduceShields(0,Math.abs(w));
  172.          }
  173.          counterFlag = 1;
  174.          return undefined;
  175.       }
  176.       if(_root.track_1.hitTest(_root.ATVclip.new_x,getBounds(_root).yMin - w,true))
  177.       {
  178.          trace("hit: _x, yMin");
  179.          thisSound = _root.bang1;
  180.          newVolume = setSoundVolume(thisSound);
  181.          thisSound.setVolume(newVolume);
  182.          thisSound.start(0,1);
  183.          if(counterFlag != 1 && _root.redTire_cheat == 0)
  184.          {
  185.             reduceShields(0,Math.abs(w));
  186.          }
  187.          counterFlag = 1;
  188.          return undefined;
  189.       }
  190.    }
  191.    function reduceShields(scoreReduce, hitpointReduce)
  192.    {
  193.       _root.ATVclip.shield.gotoAndPlay(2);
  194.       _root.ATVclip.shield._alpha -= hitpointReduce;
  195.       _root.score -= scoreReduce;
  196.       _root.hitpoints -= hitpointReduce;
  197.       if(_root.score < 0)
  198.       {
  199.          _root.score = 0;
  200.       }
  201.       if(_root.hitpoints < 0)
  202.       {
  203.          _root.hitpoints = 0;
  204.       }
  205.       if(_root.hitpoints <= 0)
  206.       {
  207.          _root._highquality = 1;
  208.          myTarget = "lose" + _root.course;
  209.          _root.gotoAndStop(myTarget);
  210.       }
  211.    }
  212.    function checkForMines()
  213.    {
  214.       mineTimer++;
  215.       if(Key.isDown(77) && mineTimer >= mineDelay)
  216.       {
  217.          mineCount++;
  218.          mineTimer = 0;
  219.          newMineName = "newMine" + mineCount;
  220.          duplicateMovieClip(_root.mineClip,newMineName,16384 + mineCount);
  221.          newMine = eval("_root." + newMineName);
  222.          newMine._x = this._x;
  223.          newMine._y = this._y;
  224.          newMine._visible = 1;
  225.          _root.mine.start(0,0);
  226.          newMine.gotoAndPlay(2);
  227.       }
  228.    }
  229.    antriebsModus = "grip";
  230.    _root.hitpoints = 100;
  231.    PI = 3.141592653589793;
  232.    this.thrust._visible = 0;
  233.    this._rotation = 90;
  234.    this.swapDepths(690);
  235.    mineCount = 0;
  236.    mineTimer = 0;
  237.    mineDelay = 48;
  238. }
  239.